import numpy as np

distro_profiles = {
    "Debian Sid":        [2,5,1,4,4,2,1,2],
    "Debian Stable":     [2,2,5,4,4,2,1,2],
    "Ubuntu LTS及衍生版":        [4,2,5,4,3,3,3,4],
    "Ubuntu 最新及衍生版":       [4,3,3,4,3,3,3,4],
    "Arch Linux":        [1,5,1,5,5,1,5,1],
    "AOSC OS":           [4,4,3,5,3,5,4,3],
    "Deepin":            [5,2,4,5,2,4,1,5],
    "优麒麟":            [5,2,3,5,2,4,1,5],
    "EndeavourOS":       [3,5,2,4,4,1,3,3],
"openSUSE Leap": [3,1,5,2,3,1,3,3],
"openSUSE Tumbleweed":[3,5,1,3,3,1,3,3],
"Fedora": [4,5,3,1,3,1,3,2]
}

def get_user_scores():
    questions = [
        "1. 你更希望开箱即用(5)还是高度自定义(1)",
        "2. 你更喜欢最新软件(5)还是稳定旧版(1)",
        "3. 偏好大版本发行(5)还是持续滚动更新(1)",
        "4. 本地软件支持重要性(5为非常重要)",
        "5. 需要深入系统原理并学习的程度(5为极度深入)",
        "6. 遇到问题倾向求助他人(5)还是文档自查(1)",
        "7.你是否在意默认情况下的系统占用(5非常在意，1不在意)",
        "8.你是否介意使用命令行(5非常介意，1不介意)"
    ]

    return [int(input(f"{q}\n评分(1-5): ")) for q in questions]

def calculate_distances(user_scores):
    return {
        distro: sum((np.array(scores)-np.array(user_scores))**2)
        for distro, scores in distro_profiles.items()
    }

# 主程序
user_scores = get_user_scores()
distances = calculate_distances(user_scores)
sorted_distros = sorted(distances.items(), key=lambda x: x[1])

print("\n推荐结果：")
for rank, (distro, score) in enumerate(sorted_distros, 1):
    print(f"{rank}. {distro:12} 匹配度：{int(100-score)}")
